package com.br.android.widingwheels.adapter;

import java.util.List;

import com.br.android.widingwheels.R;
import com.br.android.widingwheels.entidades.Local;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListLocaisAdapter extends BaseAdapter {

	private List<Local> listLocais;
	private Context context;

	public ListLocaisAdapter(Context context, List<Local> listLocais){
		this.context = context;
		this.listLocais = listLocais;
	}

	@Override
	public int getCount() {
		return listLocais.size();
	}

	@Override
	public Object getItem(int position) {
		return listLocais.get(position);
	}

	@Override
	public long getItemId(int itemId) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Local local = listLocais.get(position);

		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view = inflater.inflate(R.layout.layout_adapter_lista_locais, null);

		TextView textViewNomeLocal = (TextView) view.findViewById(R.id.textViewNomeLocal);
		TextView textViewEnderecoLocal = (TextView) view.findViewById(R.id.textViewEnderecoLocal);
		textViewNomeLocal.setText(local.getNomeLocal());
		textViewEnderecoLocal.setText(local.getEnderecoLocal());

		return view;
	}



}
